<?php
header('Cache-Control:max-age=1,s-maxage=1,no-cache,must-revalidate');
header('Content-type:image/png;charset=utf8');

$image = imagecreatetruecolor(200, 100);

$borderColor = imagecolorallocate($image, 255, 0, 0);
$backColor = imagecolorallocate($image, 255, 255, 255);

imagefilledrectangle($image, 0, 0, 200, 100, $borderColor);
imagefilledrectangle($image, 5, 5, 195, 95, $backColor);
//imagerectangle($image, 10, 10, 190, 90, $color2);

$str = 'abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ0123456789';

for ($i = 0; $i < 5; $i++) {
    $index = rand(0, strlen($str) - 1);
    $text = substr($str, $index, 1);
    $deg = rand(-15, 15);
    $color = imagecolorallocate($image, rand(0, 120), rand(0, 125), rand(0, 125));
    imagefttext($image, 24, $deg, 30 * $i + 30, 60, $color, 'c:\WINDOWS\Fonts\consola.ttf', $text);
}

for ($i = 0; $i < 100; $i++) {
    $color = imagecolorallocate($image, rand(0, 120), rand(0, 125), rand(0, 125));
    imagesetpixel($image, rand(10, 190), rand(10, 90), $color);
}

for ($i = 0; $i < 5; $i++) {
    $color = imagecolorallocate($image, rand(0, 120), rand(0, 125), rand(0, 125));
    imageline($image, rand(10, 190), rand(10, 90), rand(10, 190), rand(10, 90), $color);
}


imagepng($image);